import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 26727
 * Date: 2024-03-02
 * Time: 19:51
 */


public class Main {
    public static void main(String[] args) {

        //利用单调性
        int[] num = {2, 7, 11, 15, 19, 21};
        int target = 9;

        List<Integer> listA = new ArrayList<>();
        listA.add(3);

        int left = 0, right = num.length - 1;

        while (left < right) {
            int sum = num[left] + num[right];
            if (sum == target) {
                System.out.println("[" + num[left] + "," + num[right] + "]");
                break;
            } else if (sum > target) {
                right--;
            } else {
                left++;
            }
        }
    }
}



